﻿using IntelligentAgriculture.Contracts.Dto.Output;
using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.BreedingWeighCommand;
using IntelligentAgriculture.WebAPI.Application.Command.DepartMentCommand;
using IntelligentAgriculture.WebAPI.Application.CommandHandler.DepartMentCommandHandler;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.BreedingWeighCommandHandler
{
    public class BreedingQueryCommandHandler : IRequestHandler<BreedingWeighQueryCommand, Results<PageOutput<BreedingWeighOutPut>>>
    {

        private readonly IBreedingWeighService breeingService;
        private readonly ILogger<BreedingQueryCommandHandler> logger;
        public BreedingQueryCommandHandler(IBreedingWeighService breeingService, ILogger<BreedingQueryCommandHandler> logger)
        {
            this.breeingService = breeingService;
            this.logger = logger;
        }


        /// <summary>
        /// 羊只称重列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<Results<PageOutput<BreedingWeighOutPut>>> Handle(BreedingWeighQueryCommand request, CancellationToken cancellationToken)
        {
            var list = await breeingService.DepartMnetList(request.Breed);
            var results = Results<PageOutput<BreedingWeighOutPut>>.DataResult(list);
            return results;
        }









    }








}
